import { axios as request } from '@/utils/request'

// 查询流程任务信息
export function getInfo(params) {
  return request({
    url: `/workflow/runtime/get`,
    method: 'get',
    params
  })
}

// 查询任务
export function queryTask(taskId) {
  return request({
    url: `/workflow/runtime/queryTask/${taskId}`,
    method: 'get'
  })
}


// 查询个人的任务
export function queryPersonalTask(params) {
  return request({
    url: `/workflow/runtime/queryPersonalTask`,
    method: 'get',
    params
  })
}

// 查询个人参与的流程任务
export function queryPartakeTask(params) {
  return request({
    url: `/workflow/runtime/queryPartakeTask`,
    method: 'get',
    params
  })
}

// 查询个人完成的流程实例
export function queryStartProcess(params) {
  return request({
    url: `/workflow/runtime/queryStartProcess`,
    method: 'get',
    params
  })
}

// 根据流程定义查询流程的Png图片,图片以Base64形式返回
export function getProcessPngByDefinitionId(processDefinitionId) {
  return request({
    url: `/workflow/runtime/getProcessPngByDefinitionId/${processDefinitionId}`,
    method: 'get'
  })
}

// 根据流程实例查询流程的Png图片,图片以Base64形式返回
export function getProcessPng(processInstanceId) {
  return request({
    url: `/workflow/runtime/getProcessPng/${processInstanceId}`,
    method: 'get'
  })
}

// 根据流程定义查询流程的xml
export function getProcessImageByDefinitionId(processDefinitionId) {
  return request({
    url: `/workflow/runtime/getProcessImageByDefinitionId/${processDefinitionId}`,
    method: 'get'
  })
}

// 根据流程实例查询流程的xml
export function getProcessImage(processInstanceId) {
  return request({
    url: `/workflow/runtime/getProcessImage/${processInstanceId}`,
    method: 'get'
  })
}

// 新建流程
export function create(deploymentId) {
  return request({
    url: `/workflow/runtime/create/${deploymentId}`,
    method: 'get'
  })
}

// 完成任务
export function completeTask(taskId) {
  return request({
    url: `/workflow/runtime/completeTask/${taskId}`,
    method: 'get'
  })
}

// 保存流程任务
export function save(data) {
  return request({
    url: `/workflow/runtime/save`,
    method: 'post',
    data
  })
}

// 回退流程
export function back(data) {
  return request({
    url: `/workflow/runtime/back`,
    method: 'post',
    data
  })
}

// 转发流程
export function transmit(data) {
  return request({
    url: `/workflow/runtime/transmit`,
    method: 'post',
    data
  })
}

// 指派流程
export function appoint(data) {
  return request({
    url: `/workflow/runtime/appoint`,
    method: 'post',
    data
  })
}

// 作废流程
export function remove(data) {
  return request({
    url: `/workflow/runtime/delete`,
    method: 'delete',
    data
  })
}

// 查询流程历史活动
export function queryHisTask(processInstanceId) {
  return request({
    url: `/workflow/runtime/queryHisTask/${processInstanceId}`,
    method: 'get'
  })
}

// 新建/编辑流程时获取表单布局
export function getLayout(params) {
  return request({
    url: `/workflow/runtime/getLayout`,
    method: 'get',
    params
  })
}

// 临时保存流程任务
export function saveTempData(data) {
  return request({
    url: `/workflow/runtime/saveTempData`,
    method: 'post',
    data
  })
}

// 按条件查询个人流程（知会）转发列表
export function queryNotifyProcess(params) {
  return request({
    url: `/workflow/runtime/queryNotifyProcess`,
    method: 'get',
    params
  })
}

// 查询个人未读的流程（知会）转发列表
export function queryUnReadProcess(params) {
  return request({
    url: `/workflow/runtime/queryUnReadProcess`,
    method: 'get',
    params
  })
}

// 标记流程知会（转发）为已读
export function readProcessNotify(data) {
  return request({
    url: `/workflow/runtime/readProcessNotify`,
    method: 'post',
    data
  })
}

// 查询个人的流程公示列表
export function queryProcessPublicity(params) {
  return request({
    url: `/workflow/runtime/queryProcessPublicity`,
    method: 'get',
    params
  })
}

// 根据流程分类Id分组统计流程实例
export function queryProcessStatistics(params) {
  return request({
    url: `/workflow/runtime/queryProcessStatistics`,
    method: 'get',
    params
  })
}

// 查询全部流程实例列表
export function queryAllProcessInstance(params) {
  return request({
    url: `/workflow/runtime/queryAllProcessInstance`,
    method: 'get',
    params
  })
}

// 查询我的任务各项的汇总数
export function queryTodoCount() {
  return request({
    url: `/workflow/runtime/queryTodoCount`,
    method: 'get'
  })
}



